package cn.gameback.supervisionservices.Controller;

import cn.gameback.supervisionservices.entity.Supersition;
import cn.gameback.supervisionservices.service.SupersitionService;
import cn.gameback.supervisionservices.vo.RequestVo.SupervisionVo.SupervisionQuery;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/supersition")
public class SupersitionController {

    @Autowired
    private SupersitionService supersitionService;

    @PostMapping("/pagingQuery")
    public ResponseEntity<?> queryPagingSupervision(@RequestBody SupervisionQuery supervisionQueryRequest) {
        Page<Supersition> paging = new Page<>(supervisionQueryRequest.getCurrent(), supervisionQueryRequest.getPageSize());
        IPage<Supersition> supervisionPage = supersitionService.pagingQuerySupervision(supervisionQueryRequest);
        return ResponseEntity.ok(supervisionPage);
    }
}
